//
//  WFStore.m
//  WisdomFarm
//
//  Created by 心情 on 2017/10/26.
//  Copyright © 2017年 sky. All rights reserved.
//

#import "WFStore.h"

@implementation WFCacheStore

+ (instancetype)sharedCacheStore {
    static dispatch_once_t onceToken;
    static WFCacheStore *store = nil;
    dispatch_once(&onceToken, ^{
        store = [WFCacheStore new];
    });
    return store;
}

@end

NSString *const WFStoreKeyCurrnetUser = @"WFStoreKeyCurrnetUser";
NSString *const WFStoreKeyCurrnetFarm = @"WFStoreKeyCurrnetFarm";
NSString *const WFStoreKeyCurrentCoordinate = @"WFStoreKeyCurrentCoordinate";

@implementation WFStore

+ (WFUser *)currentUser {
    return [[self defaultStore] file_objectForKey:WFStoreKeyCurrnetUser];
}

+ (void)setCurrentUser:(WFUser *)user {
    [[self defaultStore] file_setObject:user forKey:WFStoreKeyCurrnetUser];
}

+ (WFFarm *)currentFarm {
    return [[self defaultStore] file_objectForKey:WFStoreKeyCurrnetFarm];
}

+ (void)setCurrentFarm:(WFFarm *)farm {
    [[self defaultStore] file_setObject:farm forKey:WFStoreKeyCurrnetFarm];

}

@end
